<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script src="../React-js/react.development.js" type="text/javascript"></script>
    <script src="../React-js/react-dom.development.js" type="text/javascript"></script>
    <script src="../React-js/babel.min.js" type="text/javascript"></script>
    <div id="test"></div>
    <script type="text/babel">
        /*
            输入框 输入内容 点击按钮 显示内容
            输入框失去焦点 显示内容
        */
        class Demo extends React.Component{
            show = ()=>{
                console.log(this.input1.value);
            }
            show1 = ()=>{
                console.log(this.input2.value);
            }
            render(){
                return (
                    <div>
                        <input type="text" placeholder="点击显示内容" ref={currentNode=>this.input1=currentNode}/>
                        <br />
                        <button onClick={this.show}>点击显示上方内容</button><br />
                        <input type="text" placeholder="失去焦点显示内容" onBlur={this.show1} ref={c=>this.input2=c} />
                    </div>
                )
            }
        }
        ReactDOM.render(<Demo/>,document.querySelector('#test'))
    </script>
</body>
</html>